
// 导出get方式获取数据的方法 
export let get = (url, data) => {
  // 返回一个promise
  return new Promise((resolve, reject) => {
    axios.get(url, { params: data }).then(
      response => {
        resolve(response.data)
      }
    ).catch(
      () => {
        reject({ code: -1, message: "请求失败" })
      }
    )
  })
}

// 导出post方式获取数据的方法
export let post = (url, data) => {
  return new Promise((resolve, reject) => {
    axios.post(url, data ).then(
      response => {
        resolve(response.data)
      }
    ).catch(
      () => {
        reject({ code: -1, message: "请求失败" })
      }
    )
  })
}